package cn.edu.xmu.oomall.payment.microservice;

import cn.edu.xmu.oomall.payment.microservice.bo.WeChatPayRefund;
import cn.edu.xmu.oomall.payment.microservice.bo.WeChatPayTransaction;
import cn.edu.xmu.oomall.payment.microservice.vo.WeChatPayPrepayRetVo;
import cn.edu.xmu.oomall.payment.microservice.vo.WeChatPayRefundVo;
import cn.edu.xmu.oomall.payment.microservice.vo.WeChatPayTransactionVo;
import cn.edu.xmu.privilegegateway.annotation.aop.LoginUser;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "wechatpay-service",url= "http://116.63.169.151:8088")
public interface WechatpayService {
    /**
     * WeChat Pay统一下单
     */
    @PostMapping("/internal/wechat/pay/transactions/jsapi")
    InternalReturnObject<WeChatPayPrepayRetVo> createTransaction(@Validated @RequestBody WeChatPayTransactionVo weChatPayTransactionVo);

    /**
     * WeChat Pay查询订单
     */
    @GetMapping("/internal/wechat/pay/transactions/out-trade-no/{out_trade_no}")
    InternalReturnObject<WeChatPayTransaction> getTransaction(@PathVariable("out_trade_no") String outTradeNo);

    /**
     * WeChat Pay关闭订单API
     */
    @PostMapping("/internal/wechat/pay/transactions/out-trade-no/{out_trade_no}/close")
    InternalReturnObject closeTransaction(@PathVariable("out_trade_no") String outTradeNo);

    /**
     * WeChat Pay申请退款
     */
    @PostMapping("/internal/wechat/refund/domestic/refunds")
    InternalReturnObject createRefund(@Validated @RequestBody WeChatPayRefundVo weChatPayRefundVo);

    /**
     * WeChat Pay查询单笔退款
     */
    @GetMapping("/internal/wechat/refund/domestic/refunds/{out_refund_no}")
    InternalReturnObject<WeChatPayRefund> getRefund(@PathVariable("out_refund_no") String outRefundNo);

    /**
     *
     * WeChat Pay申请资金账单API
     */
    @GetMapping("/internal/wechat/bill/fundflowbill")
    InternalReturnObject getFundFlowBill(@RequestParam("bill_date") String billDate);


    }
